package com.example.base.net

import android.content.Context
import androidx.room.Room
import com.example.base.db.ParkDataBase
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object ProviderFactory {
    @Provides
    @Singleton
    fun service(): ApiService = getService()

    @Provides
    @Singleton
    fun darabase(@ApplicationContext app: Context): ParkDataBase =
        Room.databaseBuilder(app, ParkDataBase::class.java, "park.db")
            .build()
}